# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=man-pages-posix
pkgver=2017a
_majorver=${pkgver%*[a-z]}
_minorver=${pkgver##${_majorver}}
pkgrel=0
pkgdesc="POSIX.1-$_majorver manual pages"
url="https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-posix/"
arch="noarch"
license="custom"
source="https://cdn.kernel.org/pub/linux/docs/man-pages/man-pages-posix/man-pages-posix-$_majorver-$_minorver.tar.xz"
builddir="$srcdir/$pkgname-$_majorver"
# just manpages
options="!check"

package() {
	for sect in 0 1 3; do
		sed -i "/^\.so /s/man${sect}p/man$sect/" man${sect}p/*
		mkdir -p "$pkgdir"/usr/share/man/man${sect}
		mv man${sect}p/* "$pkgdir"/usr/share/man/man$sect/
	done
	find "$pkgdir"/usr/share/man -name "*.[0-9]" -o -name "*.[0-9]p" \
		| xargs gzip -9

	install -Dm644 POSIX-COPYRIGHT \
		"$pkgdir"/usr/share/licenses/$pkgname/COPYING
}

sha512sums="
dac6bd5bb3e1d5f8918bad3eb15e08eeb3e06ae160c04ccd5619bfb0c536139ac06faa62b6856656a1bb9a7496f3148e52a5227b83e4099be6e6b93230de211d  man-pages-posix-2017-a.tar.xz
"
